/**
 *
 *//*

package com.legrand.www.module.authentication.controller;

import com.tomaer.framework.modules.authentication.dto.TokenDTO;
import com.tomaer.framework.modules.authentication.pto.UserPTO;
import com.tomaer.framework.modules.authentication.service.LoginSMSVerificationCodeService;
import com.tomaer.framework.modules.authentication.service.UserTokenService;
import com.tomaer.framework.modules.core.entity.LoginSMSVerificationCode;
import com.tomaer.framework.modules.exception.IllegalRequestArgumentException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

*/
/**
 * @author tomaer
 *//*

@RestController
@RequestMapping("/api/auth")
public class TokenContoller2 {

       @Autowired
       private UserTokenService userTokenService;

       @Autowired
       private LoginSMSVerificationCodeService loginSMSVerificationCodeService;
       private static final Logger logger = LoggerFactory.getLogger(TokenContoller.class);

       @PostMapping("/username")
       public ResponseEntity<TokenDTO> accessTokenByUsername(@RequestBody UserPTO pto) {
              if ( null == pto ) {
                     logger.error("Request body is null");
                     throw new IllegalRequestArgumentException("Request body is null");
              }
              final String username = pto.getUsername();
              final String password = pto.getPassword();
              if ( StringUtils.isBlank(username) ) {
                     logger.error("Request body json username is null or empty");
                     throw new IllegalRequestArgumentException("Request body json username is null or empty");
              }
              if ( StringUtils.isBlank(password) ) {
                     logger.error("Request body json password is null or empty");
                     throw new IllegalRequestArgumentException("Request body json password is null or empty");
              }
              TokenDTO token = userTokenService.getUserByUsername(username, password);
              return new ResponseEntity<>(token, HttpStatus.OK);
       }

       @PostMapping("/mobilephone")
       public ResponseEntity<TokenDTO> accessTokenByMobilephone(@RequestBody UserPTO pto) {
              if ( null == pto ) {
                     logger.error("Request body is null");
                     throw new IllegalRequestArgumentException("Request body is null");
              }
              final String mobilephone = pto.getMobilephone();
              final String verificationCode = pto.getVerificationCode();
              if ( StringUtils.isBlank(mobilephone) ) {
                     logger.error("Request body json mobilephone is null or empty");
                     throw new IllegalRequestArgumentException("Request body json mobilephone is null or empty");
              }
              if ( StringUtils.isBlank(verificationCode) ) {
                     logger.error("Request body json verificationCode is null or empty");
                     throw new IllegalRequestArgumentException("Request body json verificationCode is null or empty");
              }
              TokenDTO token = userTokenService.getUserByMobilephone(mobilephone, verificationCode);
              return new ResponseEntity<TokenDTO>(token, HttpStatus.OK);
       }

       @GetMapping("/refresh/{refreshToken}")
       public ResponseEntity<TokenDTO> refreshToken(@PathVariable("refreshToken") final String refreshToken) {
              TokenDTO token = userTokenService.refreshToken(refreshToken);
              return new ResponseEntity<TokenDTO>(token, HttpStatus.OK);
       }

       @DeleteMapping("/invoke/{accessToken}")
       public <T> ResponseEntity<T> invokeToken(@PathVariable("accessToken") final String accessToken) {
              userTokenService.invokeToken(accessToken);
              return new ResponseEntity<T>(HttpStatus.NO_CONTENT);
       }


       @RequestMapping("/sec/test")
       public String test() {
              return "123";
       }
}
*/
